package ssh.service.impl;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Component;

import ssh.dao.UserDao;
import ssh.model.User;
import ssh.service.UserManager;

@Component("userManager")
public class UserManagerImpl implements UserManager {

	private UserDao userDao;

	@Override
	public boolean exists(User u) throws Exception {
		return userDao.checkUserExistsWithName(u.getUsername());
	}

	@Override
	public void add(User u) throws Exception {
		userDao.save(u);
	}

	public UserDao getUserDao() {
		return userDao;
	}

	@Resource(name = "userDao")
	public void setUserDao(UserDao userDao) {
		this.userDao = userDao;
	}

}
